package parser;

import java.util.ArrayList;
import java.util.HashMap;

import scanner.Token;

public class Phase2Driver {

	/**
	 * The file name of the code file
	 */
	private String filename;
	/**
	 * Root of the syntax tree
	 */
	private AstNode root;
	/**
	 *  dataholder of assignment statements
	 */
	HashMap<String,Object> memory;
	public Phase2Driver()
	{
		memory = new HashMap<String,Object>();
	}
	
	
	public void run()
	{
		ArrayList<Token> tokens = Utility.getTokens();
		ParseTreeGenerator test = new ParseTreeGenerator(tokens);
		root = test.generateParseTree();
		try{
			root.execute(memory);
		}catch(NullPointerException e){System.out.println("Improper Syntax of Script");return;}
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Phase2Driver driver = new Phase2Driver();
		driver.run();
	}

}
